import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 公共样式文件
import 'normalize.css'
import 'element-plus/dist/index.css'
import ElementPlus from 'element-plus'
import { registerMicroApps, start } from 'qiankun'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

registerMicroApps([
  {
    name: 'blog_app01',
    entry: '//localhost:3001', // 刚刚设置的端口号
    container: '#blog', // 挂在地，所在主应用的元素id
    activeRule: '/blog', //子引用所展示的路由
  },
  {
    name: 'chat_app02',
    entry: '//localhost:3002', // 刚刚设置的端口号
    container: '#chat',
    activeRule: '/chat',
  },
  {
    name: 'individual_app03',
    entry: '//localhost:3003', // 刚刚设置的端口号
    container: '#individual',
    activeRule: '/individual',
  },
  {
    name: 'others_app04',
    entry: '//localhost:3004', // 刚刚设置的端口号
    container: '#others',
    activeRule: '/others',
  },
])

// 启动 qiankun
start({
  sandbox: { strictStyleIsolation: true, experimentalStyleIsolation: true },
})
// @ts-ignore
window.ElementPlus = ElementPlus
const app =createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(store).use(router).use(ElementPlus)

app.mount('#app')
